package com.a.module_map

import android.content.Context
import androidx.work.Worker
import androidx.work.Workbarameters
import com.blankj.utilcode.util.LogUtils
import com.tencent.map.geolocation.TencentLocation
import com.tencent.map.geolocation.TencentLocationListener
import com.tencent.map.geolocation.TencentLocationManager
import com.tencent.map.geolocation.TencentLocationRequest

/**
 * CREATE BY 黄炜强
 * 2022/7/26 14:50
 * Desc:
 * */
class LocationWork(context: Context, parameters: Workbarameters) : Worker(context, parameters),
    TencentLocationListener {
    private lateinit var mLocationManager: TencentLocationManager
    private lateinit var mLocationRequest: TencentLocationRequest

    override fun doWork(): Result {
        return Result.success()
    }

    override fun onLocationChanged(p0: TencentLocation?, p1: Int, p2: String?) {
        LogUtils.d(p0)
    }

    override fun onStatusUpdate(p0: String?, p1: Int, p2: String?) {

    }

//    fun useTencentNaviApp(toName: String, vararg location: Double) {
//        LogUtils.d(toName)
//
//        if (location.size < 4) {
//            TipUtil.toast("调用失败，位置参数不足")
//            return
//        }
//        try {
//            val uri = Uri.parse(
//                "qqmap://map/routeplan?type=drive&to=" + toName +
//                        "&fromcoord=" + location[0] + "," + location[1] +
//                        "&tocoord=" + location[2] + "," + location[3] + "&referer=XC6BZ-ZSL6Q-SST5Y-G757Y-ERCR3-ZLBKB"
//            )
//            val intent = Intent()
//            intent.data = uri
//            BaseApp.getContext().startActivity(intent)
//        } catch (e: Exception) {
//            e.printStackTrace()
//            TipUtil.toast("请安装腾讯地图")
//        }
//    }
}